package com.um.jdy.common.device.events;

import lombok.Getter;
import org.springframework.context.ApplicationEvent;
import org.springframework.core.ResolvableType;
import org.springframework.core.ResolvableTypeProvider;

/**
 * @author 甘天伟
 * @date 2022/2/19
 * 版权所有 广州优匠科技有限公司
 */
public class FeeEvent<T> extends ApplicationEvent implements ResolvableTypeProvider {


    /**
     * 事件发生时间
     */
    @Getter
    private final long eventTime;

    /**
     * 事件数据
     */
    @Getter
    private final T data;

    public FeeEvent(Object source, long eventTime, T data) {
        super(source);
        this.eventTime = eventTime;
        this.data = data;
    }

    @Override
    public ResolvableType getResolvableType() {
        return ResolvableType.forClassWithGenerics(getClass(), ResolvableType.forInstance(data));
    }
}
